<?php
/**
 * Created by PhpStorm.
 * User: DELL
 * Date: 2018/7/15
 * Time: 14:34
 */

namespace app\common\model;


class Version extends Base
{
    protected $table = 'app_version';

    /**
     * 通过type获取最后一条版本内容
     * @param string $type
     * @return array|false|\PDOStatement|string|\think\Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getLastNormalVersionByAppType($type = '')
    {
        $data = [
            'status'=>1,
            'type'=>$type
        ];
        $order = ['id'=>'desc'];
        return $this->where($data)
                    ->order($order)
                    ->limit(1)
                    ->find();
    }
}